package com.itheima.user.controller;

import com.itheima.entity.dto.NotificationSettingsDto;
import com.itheima.entity.pojo.NotificationSettings;
import com.itheima.entity.vo.Result;
import com.itheima.user.service.NotificationSettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author :wujunjie
 * createTime :2022-12-21 10:24
 * description :
 */
@RestController
@RequestMapping("/userService/notificationSettings")
public class NotificationSettingsController {
    @Autowired
    private NotificationSettingsService notificationSettingsService;

    @PutMapping
    private Result update(@RequestBody NotificationSettingsDto notificationSettingsDto){
        Boolean update=notificationSettingsService.update(notificationSettingsDto);
        if (update){
            return Result.success();
        }
        return Result.error();
    }

    @GetMapping
    private Result select( ){
        NotificationSettings notificationSettings=notificationSettingsService.select();
            return Result.success(notificationSettings);
    }



}
